Name:           miptgraph
Version:        %{getenv:VERSION}
Release:        %{getenv:RELEASE}%{?dist}
Summary:        C++ Library for Graph Representation and Algorithms
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
Prefix:/usr

License:        AGPLv3.0
URL:            https://github.com/gml4gtk/miptgraph/tree/main/miptgraph
Source0:        https://github.com/miptgraph/archive/refs/tags/v%{version}.%{release}.tar.gz

#Requires:       bash

BuildArch:      noarch

%define _topdir %(echo $PWD)/
%description
C++ Library for Graph Representation, Manipulation, Partitioning and Algorithms

%precd rm
echo "  |------------------------------------------------| "
echo "  |------------   miptgraph Library   -------------| "
echo "  |------------------------------------------------| "


%prep
cd %{_topdir}
#%{_topdir}/../targzip.sh
../targzip.sh

%build

%install
rm -rf %{buildroot}
mkdir -p %{buildroot}%{prefix}/include
cp -rp %{_topdir}/../../include/* %{buildroot}%{prefix}/include/

echo "  |------------------------------------------------| "
echo "  |--------   Installation Completed   ------------| "
echo "  |------------------------------------------------| "

%preun
echo "  |------------------------------------------------| "
echo "  |------------   miptgraph Library   -------------| "
echo "  |------------------------------------------------| "

%postun
rm -rf /usr/include/mipgraph.h /usr/include/miptgraphconfig.h
echo "  |------------------------------------------------| "
echo "  |-------   Uninstallation Completed   -----------| "
echo "  |------------------------------------------------| "

%clean
rm -rf %{buildroot}

%files
%defattr(-,root,root)
            %{prefix}/include

%changelog
* Mon Jul 26 2021 gml4gtk <mooigraph@gmail.com> - %{version}-%{release}
- First RPM package
